package quick.portal.activity;

import quick.portal.R;
import quick.view.webview.QuickWebView;
import android.annotation.SuppressLint;
import android.content.Intent;
import android.os.Bundle;
import android.webkit.WebChromeClient;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;

@SuppressLint("SetJavaScriptEnabled")
public class WebviewActivity extends BaseEditActivity {
	
	private QuickWebView webView;
	
	@Override
    protected void onCreate(Bundle savedInstanceState) {
		
		super.onCreate(savedInstanceState);

        this.setContentView(R.layout.webview_layout);
        this.setBackButton();
        
        Intent intent = this.getIntent();
        String url = intent.getStringExtra("Url");
        
        webView = (QuickWebView) findViewById(R.id.browse);
        
        WebSettings websettings = webView.getSettings();
        websettings.setJavaScriptEnabled(true);
        websettings.setBuiltInZoomControls(true);

        webView.setWebViewClient(new WebViewClient() {
            public boolean shouldOverrideUrlLoading(WebView view, String url) {
                view.loadUrl(url);
                return true;
            }
        });
        
        webView.setWebChromeClient(new WebChromeClient() {
            @Override
            public void onCloseWindow(WebView webView) {
            	WebviewActivity.this.finish();
            }
        });
        
        webView.loadUrl(url);

	}
}
